import React, { createContext } from "react";
import { Children, IContext } from "../typing";

const AppContext = createContext<IContext>({
  context: {
  },
  setContext: ()=>{}
})

export function ContextProvider({children}:Children){
  const [context, setContext] = React.useState({})

  return (
    <AppContext.Provider value={{context, setContext}}>{children}</AppContext.Provider>
  )
}

export function useAppContext(){
  return React.useContext(AppContext)
}